<p-panel header="筛选查询" [collapsed]="false" headerClass="bg-eaeaea border-none" search="客户姓名/客户手机号/项目编号" (onSearch)=" normalSearchFun();dt.reset()"
  [(searchText)]="searchObj.searchValue" maxlength="20">
  <div class="p-b-20 border-b-d9d9d9">
    <p-selectButton [canDelete]="true" [options]="status" optionLabel='name' (onChange)="normalSearchFun();dt.reset()" [(ngModel)]="selectStatus"></p-selectButton>
  </div>
  <div class="p-t-20 clearfix">
    <div class="m-r-15 inline-block1 org">
      <span class="opacity06">组织名称：</span>
      <div class="inline-block">
        <p-treeselect [value]="organizationArray" styleClass="width-150" [filter]="true" placeholder="全部" selectionMode="single"
          [(selection)]="seletcedOrganization"></p-treeselect>
      </div>
    </div>

    <div class="m-r-15 inline-block">
      <span class="opacity06">合同竣工开始：</span>
      <p-calendar [(ngModel)]="searchObj.contractEndStartDate" [maxDate]="contractCompletedStartDateMax" styleClass="p-calendar width-145"
        placeholder="请选择" inputStyleClass="height-full" (onClearClick)="clearStart('contract') " (onSelect)="updateCalendarStartTime('contract')"></p-calendar>
    </div>

    <div class="m-r-15 inline-block">
      <span class="opacity06">结束：</span>
      <p-calendar [(ngModel)]="searchObj.contractEndEndDate" styleClass="p-calendar width-145" placeholder="请选择" inputStyleClass="height-full"
        (onSelect)="updateCalendarEndTime('contract')" (onClearClick)="clearEnd('contract') " [minDate]="contractCompletedEndDateMin"></p-calendar>
    </div>

    <div class="inline-block">
      <span class="opacity06">装修区域：</span>
      <input type="text" pInputText maxlength='20' placeholder="请输入" [(ngModel)]="searchObj.decorationAddress" class="p-input width-150">
    </div>
    <div class="inline-block pull-right">
      <button pButton type="button" (click)="normalSearchFun();dt.reset()" label="查询" class="btn btn-success m-r-10"></button>
      <button pButton type="button" (click)="isShowH= true" label="高级搜索" class="btn btn-primary"></button>
    </div>
  </div>
</p-panel>


<p-dataTable #dt scrollable="true" [value]="listData" [totalRecords]="totalRecords" [lazy]="true" [marginHeight]="20" (onLazyLoad)="onPage($event)"
  [paginator]="true" [(selection)]="selectedDatas" [headerCheckboxToggleAllPages]="true">
  <p-header>
    <button pButton type="button" label="重新派单" class="btn btn-secondary" (click)="againOrder()"></button>
    <button pButton type="button" label="匹配施工模板" class="btn btn-secondary" (click)="matchingOrder()"></button>
    <button pButton type="button" label="发起处罚" class="btn btn-secondary" (click)="punishments()"></button>
    <button pButton type="button" label="停工" class="btn btn-secondary" (click)="lockout($event)"></button>
    <button pButton type="button" label="复工" class="btn btn-secondary" (click)="recover($event)"></button>
  </p-header>
  <p-column [style]="{'width':'46px'}" selectionMode="multiple"></p-column>
  <p-column *ngFor="let col of dataHead" [field]='col.field' [header]='col.header' [hidden]="col.hidden" [sortable]="col.sortable"
    [style]="{'width':col.width}">
    <ng-template let-index='rowIndex' let-data='rowData' pTemplate='body' *ngIf="col.tem">
      <div *ngIf="col.field === 'sortNum'">
        {{index+1}}
      </div>
      <div *ngIf="col.field === 'businessOpportunityCode'">
        <a class="color-1a91eb" [title]="data[col.field]" target="_blank" [routerLink]="['/saas/engineer/constructionprocess/constructionmanage', data.id,data.businessOpportunityCode]">
          {{data.businessOpportunityCode}} </a>
      </div>
      <div *ngIf="col.field === 'templateName'">
        {{data.templateId?data.templateName:'匹配失败'}}
      </div>
      <div *ngIf="col.field === 'contructionStatus'">
        {{storage.dicFilter(col.dic,data[col.field])}}
      </div>
    </ng-template>
  </p-column>
</p-dataTable>




<p-dialog header="添加筛选条件" [(visible)]="isShowH" modal="modal" width="800" [responsive]="true">
  <p-header>
    <span class="font-12"> (注：将您要添加的筛选条件进行改动，就视为添加该筛选条件。如不需要，请改回默认。)</span>
  </p-header>

  <div class="ui-g">
    <div class="ui-g-6">
      <div class="table-row">
        <div class="table-cell text-right p-r-10">项目状态：</div>
        <div class="table-cell">
          <p-dropdown dataKey="code" appendTo="body" placeholder="全部" optionLabel="name" styleClass="width-220" [options]="statusH"
            [(ngModel)]="selectedHStatus"></p-dropdown>
        </div>
      </div>

      <div class="table-row">
        <div class="table-cell text-right p-r-10">组织名称：</div>
        <div class="table-cell">
          <p-treeselect [value]="organizationArray" styleClass="width-220" [filter]="true" placeholder="全部" selectionMode="single"
            [(selection)]="seletcedHOrganization"></p-treeselect>
        </div>
      </div>

      <div class="table-row">
        <div class="table-cell text-right p-r-10">客户姓名：</div>
        <div class="table-cell">
          <input type="text" placeholder="请输入" class="p-input width-220" pInputText [(ngModel)]="searchHighObj.consumerName">
        </div>
      </div>

      <div class="table-row">
        <div class="table-cell text-right p-r-10">合同竣工开始：</div>
        <div class="table-cell ">
          <p-calendar appendTo='body' pannelClass="max-width-250" [maxDate]="completedMaxTime" [(ngModel)]="searchHighObj.contractEndStartDate"
            placeholder="请选择" styleClass="p-calendar  width-220" (onClearClick)="clearStart('hContract')" (onSelect)="updateCalendarStartTime('hContract')"
            inputStyleClass="height-full"></p-calendar>
        </div>
      </div>
      <div class="table-row">
        <div class="table-cell text-right p-r-10">项目经理：</div>
        <div class="table-cell">
          <input type="text" placeholder="请输入" class="p-input width-220" pInputText [(ngModel)]="searchHighObj.foremanName">
        </div>
      </div>
      <div class="table-row">
        <div class="table-cell text-right p-r-10">设计师：</div>
        <div class="table-cell">
          <input type="text" placeholder="请输入" class="p-input width-220" pInputText [(ngModel)]="searchHighObj.houseAdviserName">
        </div>
      </div>

    </div>

    <div class="ui-g-6">
      <div class="table-row">
        <div class="table-cell text-right p-r-10">装修区域：</div>
        <div class="table-cell">
          <input type="text" placeholder="请输入" class="p-input width-220" pInputText [(ngModel)]="searchHighObj.decorationAddress">
        </div>
      </div>

      <div class="table-row">
        <div class="table-cell text-right p-r-10">项目编号：</div>
        <div class="table-cell">
          <input type="text" placeholder="请输入" class="p-input width-220" pInputText [(ngModel)]="searchHighObj.businessOpportunityCode">
        </div>
      </div>

      <div class="table-row">
        <div class="table-cell text-right p-r-10">客户手机号：</div>
        <div class="table-cell">
          <input type="text" placeholder="请输入" class="p-input width-220" pInputText [(ngModel)]="searchHighObj.consumerPhone">
        </div>
      </div>

      <div class="table-row">
        <div class="table-cell text-right p-r-10">合同竣工结束：</div>
        <div class="table-cell ">
          <p-calendar appendTo='body' pannelClass="max-width-250" [minDate]="completedMinTime" [(ngModel)]="searchHighObj.contractEndEndtDate"
            placeholder="请选择" styleClass="p-calendar  width-220" (onClearClick)="clearEnd('hContract')" (onSelect)="updateCalendarEndTime('hContract')"
            inputStyleClass="height-full"></p-calendar>
        </div>
      </div>
      <div class="table-row">
        <div class="table-cell text-right p-r-10">监理：</div>
        <div class="table-cell">
          <input type="text" placeholder="请输入" class="p-input width-220" pInputText [(ngModel)]="searchHighObj.supervisorName">
        </div>
      </div>

      <div class="table-row">
        <div class="table-cell text-right p-r-10">施工模板：</div>
        <div class="table-cell">
          <p-dropdown dataKey="id" optionLabel="name" placeholder="全部" styleClass="width-220" [options]="template" [(ngModel)]="selectedTemplate"></p-dropdown>
        </div>
      </div>

    </div>

  </div>

  <p-footer>
    <button pButton type="button" (click)="resetHSearch()" label="重置" class="btn btn-secondary m-r-20"></button>
    <button pButton type="button" (click)="advanceSearchFun();dt.reset();isShowH=false;" label="查询" class="btn btn-success"></button>
  </p-footer>
</p-dialog>
<!-- 高级搜索 end-->


<!-- 重新分配Start-->
<p-dialog header="选择" [(visible)]="isAgainOrder" width="600" modal="modal" height="253" [responsive]="true" (onHide)="selectedDatas=[]">
  <div class="text-center wrap-content">
    <div class="inline-block p-t-20" *ngIf="isAgainOrder">
      <div class="table-row ">
        <div class="table-cell p-l-25 p-required v-a-t">重新分配</div>
        <div class="table-cell text-left">
          <p-dropdown optionLabel="name" placeholder="请选择重新分配" styleClass="width-220" [options]="operation" [(ngModel)]="seletcedOperation"
            (onChange)="operationCK()"></p-dropdown>
        </div>
        <div class="table-cell relative">
          <p-message styleClass="p-center v-a-m" *ngIf="operationError" severity="error" [text]="operationError"></p-message>
        </div>
      </div>

      <div class="table-row">
        <div class="table-cell text-right p-l-25 width-128"></div>
        <div class="table-cell text-left">
          <button pButton type="button" (click)="selectOperation()" label="确定" class="p-btn"></button>
        </div>
      </div>
    </div>
  </div>
</p-dialog>
<!-- 重新分配End-->


<!-- 重新选择经理End-->
<p-dialog header="选择项目经理" (onHide)="managerSearch={};" [(visible)]="managerFlag" modal="modal" width="800">
  <div class="p-8-0">
    <div class="m-r-15 inline-block">
      <div style="height:33px"></div>
    </div>
    <div class="width-250 relative pull-right">
      <input type="text" pInputText class="width-full p-input p-r-25" maxlength="20" [(ngModel)]="managerSearch.searchValue" (keyUp.enter)="managerSearchFn()"
        placeholder="姓名/手机号/用户名">
      <span class="icon-search-right" (click)="managerSearchFn()"></span>
    </div>
  </div>
  <p-dataTable #manager [value]="managerData" [totalRecords]="managerTotalRecords" lazy="true" (onPage)="managerSearchFn($event)"
    scrollable="true" scrollHeight="260px" [paginator]="true" [style]="{marginTop:'12px'}">
    <p-column *ngFor="let col of managerCols" [field]='col.field' [header]='col.header' [style]="{'width':col.width}">
      <ng-template let-index="rowIndex" let-data="rowData" pTemplate="body" *ngIf="col.tem">
        <div *ngIf="col.field === 'operation'">
          <span class="move" (click)="selectedManager(data)">选择</span>
        </div>
      </ng-template>
    </p-column>
  </p-dataTable>

</p-dialog>
<!-- 重新选择经理End-->



<!-- 重新选择监理End-->
<p-dialog header="选择监理" (onHide)="resetSupervisor()" [(visible)]="supervisorFlag" modal="modal" width="800" [responsive]="true">
  <div class="p-8-0">
    <div class="m-r-15 inline-block">
      <p-treeselect [value]="organizationArray" (onNodeSelect)="supervisorSearchFn()" styleClass="width-200" [filter]="true" placeholder="全部"
        selectionMode="single" [(selection)]="supervisorOrgSelected"></p-treeselect>
    </div>
    <div class="m-r-15 inline-block">
      <p-autoComplete [(ngModel)]="city" emptyMessage="没有搜到您想要的数据" (onBlur)="cityBlur()" styleClass="width-200" inputStyleClass="width-200"
        [suggestions]="currentCity" field="merge" (completeMethod)="selectCurrentCity($event)" [size]="30" placeholder="请选择所在城市"
        [minLength]="1" (onSelect)="supervisorSearchFn()"></p-autoComplete>
    </div>
    <div class="width-250 relative pull-right">
      <input type="text" pInputText class="width-full p-input p-r-25" maxlength="20" [(ngModel)]="supervisorSearch.searchValue"
        (keyUp.enter)="supervisorSearchFn()" placeholder="姓名/手机号/用户名">
      <span class="icon-search-right" (click)="supervisorSearchFn()"></span>
    </div>
  </div>
  <p-dataTable [value]="supervisorData" lazy="true" [style]="{marginTop:'12px'}" [totalRecords]="supervisorTotalRecords" (onPage)="supervisorSearchFn($event)"
    scrollable="true" scrollHeight="260px" [paginator]="true">
    <p-column *ngFor="let col of supervisorCols" [field]='col.field' [header]='col.header' [style]="{'width':col.width}">
      <ng-template let-index="rowIndex" let-data="rowData" pTemplate="body" *ngIf="col.tem">
        <div *ngIf="col.field === 'operation'">
          <span class="move" (click)="selectedSupervisor(data)">选择</span>
        </div>
      </ng-template>
    </p-column>
  </p-dataTable>
</p-dialog>
<!-- 重新选择监理End-->

<!-- 处罚弹窗组件 -->
<app-list-punish-dialog *ngIf="isPunishShow" [data]="punishmentsData" [isShow]="isPunishShow" (changeIsShow)="changePunishShow($event)"></app-list-punish-dialog>
<!-- 处罚弹窗组件end -->


<p-dialog header="确认停工" [(visible)]="isLockout" width="700" modal="modal" height="430" [responsive]="true">
  <div class="text-center wrap-content">
    <div class="inline-block p-t-20" *ngIf="isLockout">
      <div class="table-row ">
        <div class="table-cell text-right p-l-25 width-128 p-required">停工截止日期：</div>
        <div class="table-cell relative text-left width-320">

          <p-calendar [(ngModel)]="lockoutObj.lockoutEndTime"  [minDate]="lockoutMin" required name="lockoutEndTime" placeholder="请选择停工截止日期" [monthNavigator]="timeConfig.monthNavigator"
            [locale]="timeConfig.locale" styleClass="p-calendar width-220"  inputStyleClass="height-full"
            [dataType]="timeConfig.dataType" [showIcon]="timeConfig.showIcon" [selectOtherMonths]="timeConfig.selectOtherMonths"
            [dateFormat]="timeConfig.dateFormat" (onSelect)="getDelayEndTimeCk()" (onClearClick)="getDelayEndTimeCk()">
          </p-calendar>
          <p-message styleClass="p-center" *ngIf="lockoutEndTimeError" severity="error" [text]="lockoutEndTimeError"></p-message>
        </div>
      </div>
      <div class="table-row ">
        <div class="table-cell text-right p-l-25 width-128 p-required">停工原因：</div>
        <div class="table-cell relative text-left width-320">
          <p-dropdown optionLabel="name" placeholder="请选择停工原因" styleClass="width-220" [options]="lockoutreason" [(ngModel)]="selectedLockoutreason" (onChange)="checkFiled()"></p-dropdown>
          <p-message styleClass="p-center" *ngIf="lockoutreasonError" severity="error" [text]="lockoutreasonError"></p-message>
        </div>
      </div>
      <div class="table-row">
        <div class="table-cell text-right p-l-25 width-128 " style="vertical-align: top;">详细描述：</div>
        <div class="table-cell text-left relative width-320">
          <textarea rows="5" cols="35" name='describe' [(ngModel)]="lockoutObj.describe" [ngStyle]="{'width': '220px' }" maxlength="50"
            pInputTextarea></textarea>
          <div class="text-right opacity06" style="padding-right: 98px;">还可输入{{50 - (lockoutObj.describe?.length || 0)}}个字</div>
        </div>
      </div>
      <div class="table-row">
        <div class="table-cell text-right p-l-25 width-128"></div>
        <div class="table-cell text-left">
          <button pButton type="button" (click)="lockoutFun()" label="确定" class="p-btn"></button>
        </div>
      </div>
    </div>
  </div>
</p-dialog>
